<?php
function socketData($server, $port, $str) {
	$commonProtocol = getprotobyname ( 'TCP' );
	$socket = socket_create ( AF_INET, SOCK_STREAM, $commonProtocol );
	socket_set_option ( $socket, SOL_SOCKET, SO_RCVTIMEO, array ("sec" => 1, "usec" => 0 ) );
	socket_connect ( $socket, $server, $port );
	$i = 0;
	$data = $str;
	
	socket_write ( $socket, $data, strlen ( $data ) );	
	while (true){		    
	    socket_write ( $socket, $data, strlen ( $data ) );	
        $out = @socket_read ( $socket, 1024 );
        if ($out)
    	echo $out."\r\n";
    	sleep(1);   		
	}
				
	
	
	socket_close ( $socket );
	return $out;
}
//$num=2;
//for($i = 0; $i < $num; $i ++) {
//     pcntl_fork ();    
//}
//socketData("192.168.1.233","8080",'aaa');
while ($str = fread(STDIN,1000)){
    if (str_replace(array("\r","\n"),'',$str)){
        @eval($str);
    }
}